#ifndef _TEXTVIEW_H_LULY_
#define _TEXTVIEW_H_LULY_
#include "Font.h"
#include "Text.h"
#include "UIObject.h"
class TextView : public UIObject {
 protected:
  virtual void init() override;
  virtual void event() override;
  virtual void update() override;
  virtual void draw() override;
  virtual void drawArea(const Rect& area) override;
  Text text;
  Font font;
  Rect area;
  Color::RGBA color = {255, 255, 255, 255};
  bool textAdapt;

 public:
  // TextView(std::string uiObjectId, std::string text, int x, int y, int width,
  //          int height);
  TextView(std::string uiObjectId, std::string text, int x = 0, int y = 0);

  void setColor(Color::RGBA color) { TextView::color = color; }
  void setFont(Font font) { TextView::font = font; }

  void setText(std::string text) {
    TextView::text = Text(text, TextView::font);
    TextView::text.str_lines_update();
    TextView::drawArea(area);
  }
  std::string& getTextStr() { return TextView::text.getTextStr(); }
};

#endif